package com.salton123.whiteboard.utils

import android.graphics.Matrix

/**
 * User: wujinsheng1@yy.com
 * Date: 2020/5/26 10:25
 * ModifyTime: 10:25
 * Description:
 */
object MatrixUtils {
    fun translateX(matrix: Matrix): Float {
        val v = FloatArray(9)
        matrix.getValues(v)
        return v[Matrix.MTRANS_X]
    }

    fun translateY(matrix: Matrix): Float {
        val v = FloatArray(9)
        matrix.getValues(v)
        return v[Matrix.MTRANS_Y]
    }

    fun scaleX(matrix: Matrix): Float {
        val v = FloatArray(9)
        matrix.getValues(v)
        return v[Matrix.MSCALE_X]
    }

    fun scaleY(matrix: Matrix): Float {
        val v = FloatArray(9)
        matrix.getValues(v)
        return v[Matrix.MSCALE_Y]
    }

}